home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / maptdi.zip / NEXTDRIV.ASM < prev    next >
Assembly Source File  |  1989-04-05  |  1KB  |  32 lines

  1. ;
  2. ;   NextDriv -- Sets the DOS variable ERRORLEVEL to the number of the next
  3. ;               Novell network drive available for map allocation.
  4. ;
  5. ;               Assembled with Borland Turbo Assembler v1.00
  6. ;
  7. ;               T.Yamada of Unocal O & G, Ventura, 5Apr89
  8. ;
  9. ORG     100h                    ;Starting location for .COM file
  10. .MODEL  TINY                    ;Everything fits in a single segment
  11. .CODE
  12.  push   bp                      ;Save frame pointer
  13.  mov    bp,sp                   ;Reset FP to our curr SP
  14.  push   si                      ;Save SI
  15. Begin:
  16.  mov    cx,27                   ;Init loopdown counter, allow Z+1 for none
  17.  xor    dx,dx                   ;Start with drive A: (drive number 0)
  18. Iterate:
  19.  mov    ax,0E900h               ;DOS "Get DirHandle" function call
  20.  int    21h                     ;Do it!
  21.  or     ah,ah                   ;An available drive or Z+1 will yield 0 here.
  22.  jz     Done                    ;IF ah=0, we're through
  23.  inc    dx                      ;Otherwise, get ready for the next drive
  24.  loop   Iterate                 ;And try, try again... 'til CX = 0
  25. Done:
  26.  pop    si                      ;Restore SI
  27.  pop    bp                      ;Restore FP
  28.  mov    al,dl                   ;Set ERRORLEVEL value to DL count
  29.  mov    ah,4Ch                  ;DOS "Exit" function
  30.  int    21h                     ;Do it! A revoir!
  31. END Begin
  32.